#include<iostream>
using namespace std;
#include<unistd.h>
#include<pthread.h>
#include<vector>
void* Threadrun(void* args)
{
    pthread_detach(pthread_self());
    string name = static_cast<char *>(args);
    int cnt = 1;
    while (cnt--)
    {
        cout << name << " is run!" << endl;
        sleep(1);
    }
    return args;
}
int main()
{
    vector<pthread_t> tids;
    int num = 3;
    for (int i = 0; i < num; i++)
    {
        pthread_t id;
        char* name=new char[128];
        snprintf(name,128,"thread-%d",i+1);
        pthread_create(&id, nullptr, Threadrun, name);
        tids.emplace_back(id);
    }
    sleep(5);

    return 0;
}